// import apis from '../../request/apis.js'
var apis = {};
apis.detailApi = "https://api.douban.com/v2/book/";

Page({
    data: {
        bookid: '',
        bookDetail: {}
    },
    onLoad: function(query){
        this.setData({
            bookid: query.id
        });
        this.getBookDetail();
        console.log('hahah: \n'+this.data.bookid);
    },
    getBookDetail: function(){
        var _this = this;
        wx.request({
            url: apis.detailApi + _this.data.bookid,
            header: {
                'Content-Type': 'application/json'
            },
            success: function(res){
                console.log(res);
                _this.setData({
                    bookDetail: res.data
                });
            },
            complete: function(){
                console.log('complete');
            },
            fail: function(e){
                console.dir(e);
            }    
        });
    }
});